package com.toycloud.business.controller.feedback;

import com.toycloud.business.dto.params.ProductQuantityParams;
import com.toycloud.business.dto.results.CommonResult;
import com.toycloud.business.dto.results.ProductProblemQuantity;
import com.toycloud.business.dto.results.ProductQualityAnalysis;
import com.toycloud.business.dto.results.ProductQualityTrend;
import com.toycloud.business.service.IProductQualityAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author hlchan
 * @version 1.0
 * @date 2024/10/18 14:18
 */
@RestController
@RequestMapping("/productQualityAnalysis")
public class ProductQualityAnalysisController {

    @Autowired
    IProductQualityAnalysisService productQualityAnalysisService;

    @PostMapping("/problem/list")
    public CommonResult<ProductQualityAnalysis> getProblemList(@RequestBody ProductQuantityParams params) {
        return productQualityAnalysisService.getProblemList(params);
    }

    @PostMapping("/problemResolve/list")
    public CommonResult<ProductQualityAnalysis> getProblemResolveList(@RequestBody ProductQuantityParams params) {
        return productQualityAnalysisService.getProblemResolveList(params);
    }

    @PostMapping("/problem/quantity")
    public CommonResult<ProductProblemQuantity> getProblemQuantity() {
        return productQualityAnalysisService.getProblemQuantity();
    }

    @PostMapping("/problem/trend")
    public CommonResult<ProductQualityTrend> getProblemTrend(@RequestBody ProductQuantityParams params) {
        return productQualityAnalysisService.getProblemTrend(params);
    }

    @PostMapping("/problem/exportTemplate")
    public void exportTemlpate(HttpServletResponse response){
        productQualityAnalysisService.exportTemplate(response);
    }
}
